package models

import (
	"github.com/jinzhu/gorm"
	_ "github.com/jinzhu/gorm/dialects/mysql"
)

var DB *gorm.DB

func MysqlDB() {
	var err error
	DB, err = gorm.Open("mysql", "root:root@(127.0.0.1:3306)/day22?charset=utf8mb4&parseTime=True&loc=Local")
	if err != nil {
		panic(err)
	}
	DB.AutoMigrate(&User{}, &Advert{})

}
